# import Image
 
# infile = 'Earth.png'
# outfile = 'Earth2.png'
# im = Image.open(infile)
# (x,y) = im.size #read image size
# x_s = 1366 #define standard width
# y_s = y * x_s / x #calc height based on standard width
# out = im.resize((x_s,y_s),Image.ANTIALIAS) #resize image with high-quality
# out.save(outfile)


from PIL import Image,ImageFont,ImageDraw
#im=Image.open('b.jpg')
im = Image.new('RGBA',(1366,768), (0,0,0))
#im=im.rotate(20)
im1=Image.open('x.png')
im1.thumbnail((800,400))
im.paste(im1,(470,180))
#im.show()

draw=ImageDraw.Draw(im)  
#newfont=ImageFont.truetype('.ttf',40)#设置字体，simkai为楷体，字体大小40，truetype相关知识可百度  
draw.text((1340,760),'~~~~~~~~~~~~~~~',(255,255,255)) #第一个tuple表示要写在哪里，(left,up)，之后写的#文字，颜色为黄色，三通道设置可以百度，第<span style="white-space:pre">                               </span> #一个是红色，第二个绿色，第三个是蓝色，从0到255，最后设置字体  
im.save('new.png')
#print 'original size: ',x,y
#print 'adjust size: ',x_s,y_s